<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * tutor Hieu Ho
 */

class Giaodich extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('giaodich_model');
    }

    function load_html($path, $data) {
        $this->load->view('user/common/header_view', $data);
        $this->load->view('user/common/left_sidebar_view', $data);
        $this->load->view('user/common/head_content_view', $data);
        $this->load->view($path, $data);
        $this->load->view('user/common/right_sidebar_view', $data);
        $this->load->view('user/common/footer_view', $data);
    }

    function load_thank_view() {
    }

    public function chongiasu($id, $id_giasu) {
        $session_data = $this->session->userdata('logged_in');
        $data['id'] = $session_data['id'];
        $data['data'] = $this->giaodich_model->load_chongiasu($id, $id_giasu);
        $this->load_html('giaodich/display_lamgiasu_thank', $data);
    }

    public function chonlop($id, $id_lop) {
        $session_data = $this->session->userdata('logged_in');
        $data['id'] = $session_data['id'];
        $data['data'] = $this->giaodich_model->load_chonlop($id, $id_lop);
        $this->load_html('giaodich/display_lamgiasu_thank', $data);
    }

    public function hoanthanh_chongiasu($id_timgiasu, $id_giasu) {
        $session_data = $this->session->userdata('logged_in');
        $id_phuhuynh = $session_data['id'];
//thay doi trang thai
        $this->giaodich_model->load_hoanthanh_chongiasu($id_timgiasu);
//tao lop
        $this->giaodich_model->taolop($id_timgiasu, $id_phuhuynh, $id_giasu);
        $this->load_html('giaodich/display_lamgiasu_thank', $data = '');
    }

    public function hoanthanh_chonlop($id_lamgiasu, $id_phuhuynh) {
        $session_data = $this->session->userdata('logged_in');
        $id_giasu = $session_data['id'];
//thay doi trang thai
        $this->giaodich_model->load_hoanthanh_chonlop($id_lamgiasu);
//tao lop
        $this->giaodich_model->taolop($id_lamgiasu, $id_phuhuynh, $id_giasu);
        $this->load_html('giaodich/display_lamgiasu_thank', $data = '');
    }

}
?>
